package com.santiao.fuel.ui.adapter

import android.app.Activity
import android.text.TextUtils
import android.util.Log
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.santiao.fuel.R
import com.santiao.fuel.bean.GasEquipBean
import com.santiao.fuel.bean.RYChargeListBean
import com.santiao.fuel.bean.SceienceItemData
import com.santiao.fuel.ui.adapter.base.BaseAdapter
import com.santiao.fuel.ui.adapter.base.BaseViewHolder
import org.w3c.dom.Text


/**
 * 煤气设备大全适配器
 */
class GasEquipAdapter(activity : Activity, id : Int, myData : MutableList<GasEquipBean>) : BaseAdapter<GasEquipBean>(activity, id, myData) {


    override fun bindView(holder: BaseViewHolder, data: GasEquipBean) {
        val rootItem = holder.itemView
        val equip_icon = rootItem.findViewById<ImageView>(R.id.equip_icon)
        val equip_title = rootItem.findViewById<TextView>(R.id.equip_title)
        val equip_desc = rootItem.findViewById<TextView>(R.id.equip_desc)

        if (TextUtils.isEmpty(data.equipName)) {
            Log.e("煤气设备大全适配器", "bindView: 设备名称为空 "  )
            return
        }


        if (TextUtils.isEmpty(data.desc)) {
            Log.e("煤气设备大全适配器", "bindView: 设备描述为空 "  )
            return
        }

        equip_icon.setBackgroundResource(data.imageId)
        equip_title.text = data.equipName ;

        equip_desc.text = data.desc
    }

}
